package com.example.shiyan3

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_content.*
import kotlinx.android.synthetic.main.activity_main.*

class contentActivity:AppCompatActivity() {
    companion object{
        fun actionStart(context: Context,img: ArrayList<Int>,name:String,price:Float, sort: String,  comment:String, store:String){
            val intent = Intent(context,contentActivity::class.java).apply{
                putExtra("img",img)
                putExtra("name",name)
                putExtra("price",price)
                putExtra("sort",sort)
                putExtra("comment",comment)
                putExtra("store",store)
            }
            context.startActivity(intent)
        }
    }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_content)

//        val title = intent.getStringExtra("news_title")
//        val content = intent.getStringExtra("news_content")
        val img = intent.getIntegerArrayListExtra("img")
        val name = intent.getStringExtra("name").toString()
        val price = intent.getStringExtra("price").toString()
        val sort = intent.getStringExtra("sort").toString()
        val comment = intent.getStringExtra("comment").toString()
        val store = intent.getStringExtra("store").toString()
        if (img != null && name !=null){
            val fragment = goodsContentFrag as contentFragment
            fragment.refresh(img,name,price,sort,comment,store)
        }
    }
}